/*
** Most appendix tables and figures not created by reg_main.do
Including:  A (drought crosstabs), B (summary stats), E (Lags), G (growth), H (precip), K (country hetero), and L (IVs)

*/


capture log close
log using reg_appendix, replace
timer on 1



**# Appendix A. Binscatter and cross-tab for drought measures

use for_reg, clear

** Table A1 (crosstab)
** no output file, just cut and paste into table
drop if flare 
gen pdsi_cat7=pdsi_cat
replace pdsi_cat7=7 if pdsi_cat>=7 & !missing(pdsi_cat)
label values pdsi_cat7 cat7
tabulate dsi_cat7 pdsi_cat7, row column

**# Figure A1 

label values dsi_cat11 cat11

tabulate continent, gen(cont)

preserve
collapse (sum) cont1-cont6, by(dsi_cat11)

*outlining bars to help with monochrome visibility
graph bar cont1-cont6, over(dsi_cat11) stack horizontal legend(label(1 "Africa") label(2 "Asia") label(3 "SE Asia/Oceania") label(4 "Europe") label(5 "N. America") label(6 "South America")) title("Remote sensed DSI") ///
bar(1, lcolor(black))  bar(2, lcolor(black))  bar(3, lcolor(black))  bar(4, lcolor(black)) bar(5, lcolor(black)) bar(6, lcolor(black)) ///
     saving(dsibins, replace)

restore
preserve
collapse (sum) cont1-cont6, by(pdsi_cat)


graph bar cont1-cont6, over(pdsi_cat) stack horizontal legend(label(1 "Africa") label(2 "Asia") label(3 "SE Asia/Oceania") label(4 "Europe") label(5 "N. America") label(6 "South America")) title("sc-PDSI") ///
bar(1, lcolor(black))  bar(2, lcolor(black))  bar(3, lcolor(black))  bar(4, lcolor(black)) bar(5, lcolor(black)) bar(6, lcolor(black)) ///
    saving(pdsibins, replace)

grc1leg2 dsibins.gph pdsibins.gph, xcommon lrows(2) 
graph export "../output/FigureA1.pdf", replace
erase dsibins.gph
erase pdsibins.gph
restore


** Figure A2 (binscatter)

** first install binsreg  (Catteneo-Crump-Farrell-Feng): https://nppackages.github.io/binsreg/.


binsreg pdsi_av drought, by(continent) nbins(20) dots(0,0) line(3,3) cb(3,3) saving("../output/FigureA2_binscatter.emf", replace)



**# Appendix B: Summary stats table 

use for_reg, clear

egen cellid=group(x y)
xtset cellid year

*explicit interactions so can use "absorb"
egen contXyear=group(continent year)

* to check senstivity to inclusion of precip
macro define weather "c.dev_tmp##c.dev_tmp##c.dev_tmp"


*to allowing looping, create drought vars with comparable names
gen rdsi_cat=dsi_cat11
gen esmrdsi=esmdsi
label values rdsi_cat cat11
label var esmrdsi "Moderate or worse drought (DSI)" 

*Use WB aquifer typology percent variables as discrete
gen alluv=(aqtyp_max=="Major Alluvial") if !missing(aqtyp_max)
gen loc_shal=(aqtyp_max=="Local/Shallow") if !missing(aqtyp_max)
gen complex=(aqtyp_max=="Complex") if !missing(aqtyp_max)
gen karst=(aqtyp_max=="Karstic") if !missing(aqtyp_max)
gen alluv_ls=(alluv | loc_shal) if !missing(aqtyp_max)
label var alluv "Major alluvial"
label var alluv_ls "Alluvial/local/shallow"
label var loc_shal "Local/shallow"
label var complex "Complex"
label var karst "Karstic"


gen up2p_ifdam=((upstream_dams-up1_count_dams)>0) if !no_upstream_subbasin
label var up2p_ifdam "Further upstream dam"
gen some_upstream=!no_upstream_subbasin
label var some_upstream "At least one upstream subbasin"
label var pop "Pop density 2000 (/km^2)"
label var pdsi_av "sc-PDSI index"
label var ifdam "Local dam"
label var ifhydro "Local hydro dam"
label var lights "Nighttime lights index"
label var ihslights "Inverse hyperbolic sine of lights index"


replace rescap=rescap/10^3
replace rescaphydro=rescaphydro/10^3
label var rescap "Reservoir capacity (km^3)"
label var rescaphydro "Reservoir capacity hydro dams (km^3)"


macro define meanlist "lights ihslights drought esmdsi pdsi_av esmpdsi  alluv loc_shal complex karst resource_norm ifdam ifhydro rescap rescaphydro up1_ifdam up1_ifhydro up2p_ifdam some_upstream  dev_tmp pop"  

* check stat sig of differences to confirm note that all are stat sig different in Table 1
* dtable $meanlist if flare==0 & !missing(lights) & !missing(conpfaf4), by(alluv_ls, tests) 
* dtable $lights ihslights drought esmdsi pdsi_av esmpdsi  alluv loc_shal karst complex resource_norm rescap rescaphydro up1_ifdam up2p_ifdam some_upstream  dev_tmp pop if flare==0 & !missing(lights) & !missing(conpfaf4), by(ifdam, tests)


estpost sum $meanlist if flare==0 & !missing(lights) & !missing(conpfaf4)
eststo all
estpost sum $meanlist if flare==0 & !missing(lights)  & !missing(conpfaf4) & alluv_ls
eststo wgw
estpost sum $meanlist if flare==0 & !missing(lights)  & !missing(conpfaf4) & !alluv_ls
eststo nogw
estpost sum $meanlist if flare==0 & !missing(lights)  & !missing(conpfaf4) & ifdam
eststo wdam
estpost sum $meanlist if flare==0 & !missing(lights)  & !missing(conpfaf4) & !ifdam
eststo nodam


esttab all wgw nogw wdam nodam using "../output/tableB1_sumstat.rtf", replace main(mean) aux(sd) nonumber label mtitle("Total" "Alluv/LS" "Other GW" "Dam"  "No Dam") onecell nogap compress title("Table B1. Summary statistics, overall and by groundwater and dam status") addnote("Means, with standard deviations for continuous variables in parentheses. All differences in means between groundwater groups and between dam groups are statistically significant at 1%, except for DSI and drought according to DSI. Upstream dam variables only for observations with some upstream subbasin.")
eststo clear




**# Appendix E: Lagged drought and weather


*explicit squares and cubes for lags
gen dev_tmpsq=dev_tmp^2
gen dev_tmpcu=dev_tmp^3


foreach v in r p {
xtreg ihslights l(0/3).esm`v'dsi l(0/3).dev_tmp*  i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
estimates store `v'dsi_lags_3
xtreg ihslights l(0/6).esm`v'dsi l(0/6).dev_tmp*  i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
estimates store `v'dsi_lags_6
}

coefplot (rdsi_lags_3, label(DSI 3 lags)) (rdsi_lags_6, label(DSI 6 lags) color(navy) ciopts(lcolor(navy))) (pdsi_lags_3, msymbol(Dh) label(sc-PDSI 3 lags))  (pdsi_lags_6, msymbol(Dh) label(sc-PDSI 6 lags) color(dkgreen) ciopts(lcolor(dkgreen))), base drop(_cons *year* *dev*) xline(0) levels(95) xtitle("Effect on ihs lights") graphregion(fcolor(white))rename(*.esmrdsi = .esmpdsi esmrdsi = esmpdsi) ylabel(1 "Current drought" 2 "1 year ago" 3 "2 years ago" 4 "3 years ago" 5 "4 years ago" 6 "5 years ago" 7 "6 years ago") 
graph export "../output/FigureE1_lags.emf", replace

eststo clear


**# Appendix G: Growth rather than levels of lights

*make cm rather mm to make axis more readable
replace dev_precip=dev_precip/10

label var dev_tmp "Temp anomaly (degrees C)"
label var dev_precip "Precip anomaly (cm per month)"


macro define weather "c.dev_tmp##c.dev_tmp##c.dev_tmp"



gen growth=d.lights/l.lights if l.lights>0
* count no change at zero as no change
replace growth=0 if d.lights==0

** Main droughts regressions

foreach v in r p {

eststo:  xtreg growth ib6.`v'dsi_cat i.year#i.continent if flare==0, fe vce(cluster conpfaf4) 
estimates store `v'dsi_basic

xtreg growth ib6.`v'dsi_cat $weather i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
estimates store `v'dsi_temp

xtreg growth esm`v'dsi  c.dev_tmp##c.dev_tmp##c.dev_tmp i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
*test c.ldev_tmp##c.l.dev_tmp##c.l.dev_tmp
estimates store `v'dsi_binary
}


coefplot  (rdsi_temp, label(DSI)) (pdsi_temp, label(sc-PDSI)), base drop(_cons *year* *dev*) xline(0) levels(95) xtitle("Change in growth in lights")  graphregion(fcolor(white)) rename(*.rdsi_cat = .pdsi_cat )
graph export "../output/FigureG1_growth.emf", replace


** Dam interactions for growth equations

* characteristics for interactions
gen nonhydro=((count_dams-count_hydro)>0)
replace rescap=rescap/10^3
replace rescaphydro=rescaphydro/10^3
gen pop=pop2000/10^3

label var ifdam "Dam"
label var nonhydro "Nonhydro dam"

*explicit interactions for cleaner output
foreach var in ifdam ifhydro nonhydro pop rescap rescaphydro {
	gen esmdsi_`var'=(dsi_cat11<=3)*`var'
	gen esmpdsi_`var'=(pdsi_cat<=3)*`var'
	local damlabel : variable label `var'
	di `var' "`damlabel'"
	label var esmdsi_`var' "`damlabel'* drought "
}

label var esmdsi_ifdam "Dam* drought"
label var esmdsi_ifhydro "Hydro dam* drought"
label var esmdsi_nonhydro "Nonhydro dam* drought"
label var esmdsi_pop "Pop density* drought"
label var esmdsi_rescap "Dam reservoir capacity* drought*"
label var esmdsi_rescaphydro "Hydro reservoir capacity* drought"



eststo: xtreg growth esmdsi esmdsi_ifdam c.dev_tmp##c.dev_tmp##c.dev_tmp i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
eststo: xtreg growth esmdsi esmdsi_ifdam esmdsi_ifhydro c.dev_tmp##c.dev_tmp##c.dev_tmp i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
eststo: xtreg growth esmdsi esmdsi_ifdam esmdsi_ifhydro esmdsi_pop c.dev_tmp##c.dev_tmp##c.dev_tmp i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
eststo: xtreg growth esmdsi esmdsi_ifdam esmdsi_rescap esmdsi_ifhydro esmdsi_rescaphydro c.dev_tmp##c.dev_tmp##c.dev_tmp i.year#i.continent if flare==0, fe vce(cluster conpfaf4)



esttab using "../output/tableG1_dams_growth.rtf", replace se r2(3) sca( "N_clust N subbasins" "N_g N cells") nomti obslast label noconstant onecell star( + .10 * .05 ** .01 ) drop(*year* _cons *tmp*) order(esmdsi esmdsi_ifdam esmdsi_rescap esmdsi_ifhydro esmdsi_rescaphydro esmdsi_pop) /*
*/ title("Table G1. Effects of dams: Growth rate of lights") /*
*/ addnote("Dependent variable is change over previous level of nighttime lights index.  Standard errors in parentheses are clustered by 4-digit subbasin. All models include a cubic in temperature deviation, cell fixed effects, and continent-year effects.")
eststo clear

**# Appendix H: Temp and precip controls

use for_reg, clear

egen cellid=group(x y)
xtset cellid year

rename dsi_cat11 rdsi_cat
replace dev_precip=dev_precip/10
label var dev_tmp "Temp anomaly (degrees C)"
label var dev_precip "Precip anomaly (cm per month)"


foreach v in dsi {

xtreg ihslights ib6.`v'_cat i.year#i.continent if flare==0, fe vce(cluster conpfaf4) 
estimates store `v'_basic


**add temperature data
xtreg ihslights ib6.`v'_cat c.dev_tmp##c.dev_tmp##c.dev_tmp i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
estimates store `v'_withtemp

**add precip data
xtreg ihslights ib6.`v'_cat c.dev_tmp##c.dev_tmp##c.dev_tmp c.dev_precip##c.dev_precip##c.dev_precip  i.year#i.continent if flare==0, fe vce(cluster conpfaf4)
estimates store `v'_pretmp
testparm c.dev_tmp##c.dev_tmp##c.dev_tmp
testparm c.dev_precip##c.dev_precip##c.dev_precip

coefplot  (`v'_basic, label(No addl climate vars)) (`v'_withtemp, label(Temperature controls)) (`v'_pretmp, label(Temp & precip)) , base drop(_cons *year* *tmp* *precip*) xline(0) levels(95) xtitle("Change in ihs nighttime lights")  graphregion(fcolor(white))  
graph export "../output/FigureH1_climate_controls_`v'dsi.pdf", replace


***margins works with reghdfe, but not with xtreg
reghdfe ihslights ib6.`v'_cat c.dev_tmp##c.dev_tmp##c.dev_tmp c.dev_precip##c.dev_precip##c.dev_precip if flare==0, absorb(cellid i.year#i.continent ) vce(cluster conpfaf4)
margins, at (dev_tmp =(-1.5(.4)1.4))
marginsplot , title("Temperature") ytitle("ihs(lights index)") saving(`v'temp, replace)
margins, at (dev_precip =(-3.3(1)4))
marginsplot , title("Precipitation")  ytitle("ihs(lights index)")  saving(`v'precip, replace)

}

graph combine dsitemp.gph dsiprecip.gph, ycommon 
graph export "../output/FigureH2_compare_temp_precip.pdf", replace
erase dsitemp.gph
erase dsiprecip.gph


**# Appendix K: Country heterogeneity
** Uses World Bank (WB) country characteristics 
** first install "wbopendata" for use of WB API and "kountry" to get country identifiers from main dataset

*Hydroelectricity share in 1999
wbopendata, indicator(EG.ELC.HYRO.ZS) year(1999) clear
rename yr1999 hydro99

keep countrycode hydro99
label var hydro99 "National hydro share"

sort countrycode

tempfile hydro
save `hydro'

*Governance indicators
*Only biennial so use 1998
wbopendata, indicator(GE.EST) year(1998) clear

rename yr1998 govteffect
label var govteffect "Govt effectiveness"

keep countrycode govteffect

sort countrycode

merge 1:1 countrycode using `hydro' 
drop _merge

tempfile ge
save `ge'

wbopendata, indicator(RQ.EST) year(1998) clear
rename yr1998 regqual
label var regqual "Regulatory quality"

keep countrycode regqual
sort countrycode

merge 1:1 countrycode using `ge' 
drop _merge

tempfile rq
save `rq'

*Trade and transporation infrastructure, startin only in 2007
wbopendata, indicator(LP.LPI.INFR.XQ) year(2007) clear

rename yr2007 tradeinf
label var tradeinf "Trade/trans infrastructure"

keep countrycode tradeinf
sort countrycode

merge 1:1 countrycode using `rq'
drop _merge

tempfile tt
save `tt'

wbopendata, indicator(NY.GDP.PCAP.CD) year(1999) clear
rename yr1999 gdppc
replace gdppc=gdppc/10000
gen ihsgdppc=asinh(gdppc)
label var gdppc "GDP per cap"
label var ihsgdppc "ihs(GDP per cap)"
keep countrycode *gdppc

merge 1:1 countrycode using `tt'
drop _merge

kountry countrycode, from(iso3c) to(iso2c)
rename _ISO2C_ country
drop if country==""

sort country

merge 1:m country using for_reg, keep(match using)
drop _merge

*explicit interactions so can use "absorb"
egen contXyear=group(continent year)


egen cellid=group(x y)
xtset cellid year

foreach var in ifdam ifhydro hydro99 govteffect regqual tradeinf gdppc ihsgdppc {
	local lbl: variable label `var'
*extreme/severe/moderate
	gen esmdsi_`var'=(dsi_cat11<=3)*`var'
	gen esmpdsi_`var'=(pdsi_cat<=3)*`var'
	label var esmdsi_`var' "`lbl'*drought"
	label var esmpdsi_`var' "`lbl'*drought"
	}



** Table K1 interactions with country-level variables
eststo: xtreg ihslights esmdsi esmdsi_ifdam esmdsi_ifhydro esmdsi_hydro99 c.dev_tmp##c.dev_tmp##c.dev_tmp if flare==0, fe vce(cluster country) absorb(contXyear)

eststo: xtreg ihslights esmdsi esmdsi_ifdam esmdsi_ifhydro esmdsi_govteffect esmdsi_regqual c.dev_tmp##c.dev_tmp##c.dev_tmp if flare==0, fe vce(cluster country) absorb(contXyear)

eststo: xtreg ihslights esmdsi esmdsi_ifdam esmdsi_ifhydro esmdsi_tradeinf c.dev_tmp##c.dev_tmp##c.dev_tmp if flare==0, fe vce(cluster country) absorb(contXyear)

eststo: xtreg ihslights esmdsi esmdsi_ifdam esmdsi_ifhydro esmdsi_ihsgdppc c.dev_tmp##c.dev_tmp##c.dev_tmp if flare==0, fe vce(cluster country) absorb(contXyear)

esttab using "../output/tableK1_country_heterogeneity.rtf", replace se r2(3) sca( "N_clust N countries" "N_g N cells") order(esmdsi esmdsi_ifdam esmdsi_ifhydro) nomti obslast label noconstant onecell star( + .10 * .05 ** .01 ) drop(*dev_tmp*  _cons) /*
*/ title("Table J1. Effects of dams on drought impacts with additional country heterogeneity") /*
*/ addnote("Notes: Dependent variable is inverse hyperbolic sine of nighttime lights index. Standard errors in parentheses are clustered by country. All models include a cubic in temperature, fixed effects for cells, and continent*year effects.")
eststo clear



** Figure K1 Country-year effects
* run regressions with country year effects

egen countryXyear=group(country year)
rename pdsi_cat pdsi_cat11

foreach v in dsi pdsi {

xtreg ihslights ib6.`v'_cat11  if flare==0, fe absorb(countryXyear)  vce(cluster conpfaf4) 
estimates store `v'_basic


**add temperature data
xtreg ihslights ib6.`v'_cat11 c.dev_tmp##c.dev_tmp##c.dev_tmp if flare==0, fe absorb(countryXyear) vce(cluster conpfaf4)
estimates store `v'_withtemp

xtreg ihslights esm`v' c.dev_tmp##c.dev_tmp##c.dev_tmp if flare==0, fe absorb(countryXyear) vce(cluster conpfaf4)
estimates store `v'_binary
}


coefplot  (dsi_withtemp, label(DSI)) (pdsi_withtemp, msymbol(Dh) label(sc-PDSI)), base drop(_cons *dev*) xline(0) levels(95) xtitle("Effect on ihs lights")  graphregion(fcolor(white)) rename(*.dsi_cat11 = .pdsi_cat11)
graph export "../output/FigureK1_counry_year.emf", replace

eststo clear


**# Appendix L:  Instrumental variables


use for_reg.dta, clear


**# Means of instruments
macro define meanlist "slope max_slope dncountry_count numcountry"  

estpost sum $meanlist if flare==0 & !missing(tmp)
eststo all
estpost sum $meanlist if flare==0 & !missing(tmp) & ifdam
eststo wdam
estpost sum $meanlist if flare==0 & !missing(tmp) & !ifdam
eststo nodam


esttab all wdam nodam using "../output/tableL1_IVmeans.rtf", replace cell("mean(fmt(3)) sd(par fmt(3))") nonumber label compress
eststo clear

* test statistical significane
foreach var in $meanlist {
ttest `var', by(ifdam)
}

egen cellid=group(x y)
xtset cellid year



*interactions with various drought definitions
*explicit interactions needed for ivregress
foreach var in ifdam ifhydro cti slope max_slope dncountry_count numcountry {
	gen esmdsiX`var'=(dsi_cat11<=3)*`var'
	gen esmpdsiX`var'=(pdsi_cat<=3)*`var'
}

foreach d in dsi pdsi {
	label var esm`d'Xifdam "Dam * drought"
	label var esm`d'Xifhydro "Hydro dam * drought"
}

egen contyear=group(continent year)

**# IV regressions

foreach d in dsi pdsi {

*just slope IVs
ivregress 2sls ihslights esm`d' (esm`d'Xifdam =esm`d'Xslope esm`d'Xmax_slope) $weather  if flare==0, vce(cluster conpfaf4) absorb(contyear cellid)
estat endogenous
estadd scalar DWH = r(regF)
estadd scalar p_DWH = r(p_regF)
estat weakrobust
estadd scalar clr = r(clr)
estadd scalar p_clr= r(p_clr)
weakivtest
estadd scalar weak_F = r(F_eff) 
estadd scalar crit10 = r(c_TSLS_10)
eststo slopeIV


*just political IVs
ivregress 2sls ihslights esm`d' (esm`d'Xifdam  =esm`d'Xdncountry_count esm`d'Xnumcountry) $weather  if flare==0, vce(cluster conpfaf4) absorb(contyear cellid)
estat endogenous
estadd scalar DWH = r(regF)
estadd scalar p_DWH = r(p_regF)
estat weakrobust
estadd scalar clr = r(clr)
estadd scalar p_clr= r(p_clr)
weakivtest
estadd scalar weak_F = r(F_eff) 
estadd scalar crit10 = r(c_TSLS_10)
eststo polIV

* all IV
ivregress 2sls ihslights esm`d' (esm`d'Xifdam  = esm`d'Xslope esm`d'Xmax_slope esm`d'Xdncountry_count esm`d'Xnumcountry) $weather if flare==0,  vce(cluster conpfaf4) absorb(contyear cellid)
estat endogenous
estadd scalar DWH = r(regF)
estadd scalar p_DWH = r(p_regF)
estat weakrobust
estadd scalar clr = r(clr)
estadd scalar p_clr= r(p_clr)
weakivtest
estadd scalar weak_F = r(F_eff) 
estadd scalar crit10 = r(c_TSLS_10)
eststo allIV


**# Overid tests
* produces scalars but doesn't ereturn them, even tho manual says it should; adding them to the table manually.
ivregress 2sls ihslights esm`d' (esm`d'Xifdam =esm`d'Xslope esm`d'Xmax_slope) $weather  if flare==0, vce(robust) absorb(contyear cellid) first
estat overid
estadd scalar sargan=r(sargan) : slopeIV
estadd scalar p_sargan=r(p_sargan) : slopeIV
ivregress 2sls ihslights esm`d' (esm`d'Xifdam  =esm`d'Xdncountry_count esm`d'Xnumcountry) $weather if flare==0, vce(robust) absorb(contyear cellid) first
estat overid
estadd scalar sargan=r(sargan) : polIV
estadd scalar p_sargan=r(p_sargan) : polIV
ivregress 2sls ihslights esm`d' (esm`d'Xifdam  = esm`d'Xslope esm`d'Xmax_slope esm`d'Xdncountry_count esm`d'Xnumcountry) $weather  if flare==0, vce(robust) absorb(contyear cellid) first
estat overid
ereturn list
estadd scalar sargan=r(sargan) : allIV
estadd scalar p_sargan=r(p_sargan) : allIV


if "`d'"=="dsi" {
	local tablen "2"
}
else {
local tablen "3"
}

esttab slopeIV polIV allIV using "../output/tableL`tablen'_iv_`d'.rtf", replace se sca("DWH Endogeneity (DWH)" "p_DWH p-value" "p_clr Weak instrument robust p-value for Drought*dam" "weak_F Robust F for weak instruments" "crit10 Critical value for F with 10% bias" "sargan Sargan (overid)" "p_sargan p-value" "N_clust N subbasins") obslast nocon label star( + .10 * .05 ** .01 ) drop(*tmp* _cons) /*
*/ title("IV estimates of effects of local dams on lights") order(esm`d' esm`d'Xifdam)  /* 
*/ mtitle("Geophys IV main"  "Political IV main" "All IV" ) /*
*/ addnote("Notes: Standard errors in parentheses are clustered by 4-digit subbasin. The weak instrument robust p-value tests that the Dam*Drought interaction equals zero. The F statistic for weak instruments is Montiel Olea and Pflueger robust statistic. The overidentification test is Sargan's chi-squared and is heteroskedacity, but not cluster-robust. All models include cell fixed effects, a cubic in temperature deviation, and continent-year effects.")
eststo clear



}




timer off 1
timer list 1
log close

timer clear 1 

